/ Assembly List / LJCNetCommon / HTMLBuilder / AddChildIndent

Namespace - LJCNetCommon


Parameters
createText - The previously created text.
textState - The TextState object.

Syntax

C#
public Void AddChildIndent(String createText, TextState textState)

Adds the new (child) indents.

Remarks

Adds an indent for following child elements.
The indent will only be added if the createText length > 0 and the textState.ChildIndentCount > 0.

Example

C#
// Root Method Begin
var textState = new TextState();

var result = CustomBegin("body", textState);

// result:
// <body>

private static string CustomBegin(string name, TextState textState
    , Attributes attribs = null, bool addIndent = true
    , bool childIndent = true)
{
    // Defaults: IndentCharCount = 2, LineLimit = 80, WrapEnabled = false.
    var hb = new HTMLBuilder(textState);

    var createText = hb.GetBegin(name, textState, attribs, addIndent
        , childIndent);
    // Use NoIndent after a "GetText" method.
    hb.Text(createText, NoIndent);
    // Use AddChildIndent after beginning an element.
    hb.AddChildIndent(createText, textState);
    var result = hb.ToString();

    // Append Method
    //hb.UpdateState(textState);
    return result;
}

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.